package org.example.queue;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.util.List;

@Data
public class DelayTask {

    private String taskName;
    private Integer taskId;

    private Inner inner;

    private List<Inner> innerList;

    @Data
    public static class Inner {
        private Integer innerA;
        private String innerB;
    }


    public static DelayTask of(Integer id) {
        var task = new DelayTask();
        task.setTaskName("task---" + id);
        task.setTaskId(id);
        var inner1 = new Inner();
        inner1.setInnerA(id + 1);
        inner1.setInnerB("inner b = " + (id + 1));


        var inner2 = new Inner();
        inner2.setInnerA(id + 2);
        inner2.setInnerB("inner b = " + (id + 2));
        var inner3 = new Inner();
        inner3.setInnerA(id + 3);
        inner3.setInnerB("inner b = " + (id + 3));

        task.setInner(inner1);
        task.setInnerList(List.of(inner1, inner2, inner3));

        return task;
//        return JSON.toJSONString(task);
    }
}
